<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of convgausns</title>
  <meta name="keywords" content="convgausns">
  <meta name="description" content="CONVGAUSNS  Convert Gaussian noise source from one cov_type to another">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../menu.html">Home</a> &gt;  <a href="#">ReBEL-0.2.7</a> &gt; <a href="#">core</a> &gt; convgausns.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../menu.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="menu.html">Index for .\ReBEL-0.2.7\core&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>convgausns
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>CONVGAUSNS  Convert Gaussian noise source from one cov_type to another</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function NoiseDS = convgausns(NoiseDS, target_cov_type) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> CONVGAUSNS  Convert Gaussian noise source from one cov_type to another

   NoiseDS = convgausns(NoiseDS, target_cov_type)

   Input
          NoiseDS        : (NoiseDS) Input noise source data structure (this must be of type 'gaussian' or 'combo-gaussian')
          target_cov_type : (string)  Target cov_type : 'full', 'diag', 'sqrt', 'sqrt-diag'

   Output
          NoiseDS        : (NoiseDS) Converted noise source data structure


   See also
     <a href="gennoiseds.html" class="code" title="function NoiseDS = gennoiseds(ArgDS)">GENNOISEDS</a>

   Copyright (c) Oregon Health &amp; Science University (2006)

   This file is part of the ReBEL Toolkit. The ReBEL Toolkit is available free for
   academic use only (see included license file) and can be obtained from
   http://choosh.csee.ogi.edu/rebel/.  Businesses wishing to obtain a copy of the
   software should contact rebel@csee.ogi.edu for commercial licensing information.

   See LICENSE (which should be part of the main toolkit distribution) for more
   detail.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="consistent.html" class="code" title="function errstring = consistent(ds, type)">consistent</a>	CONSISTENT   Check ReBEL data structures for consistentency.</li><li><a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>	STRINGMATCH  Returns match > 0 if string1 and string2 match (string2 can be a cell array of</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="gensysnoiseds.html" class="code" title="function [pNoise, oNoise, InferenceDS] = gensysnoiseds(InferenceDS, estimatorType, pNoiseAdaptMethod, pNoiseAdaptParams,oNoiseAdaptMethod, oNoiseAdaptParams)">gensysnoiseds</a>	GENSYSNOISEDS  Generate process and observation noise data structures for a given InferenceDS data structure</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function NoiseDS = convgausns(NoiseDS, target_cov_type)</a>
0002 
0003 <span class="comment">% CONVGAUSNS  Convert Gaussian noise source from one cov_type to another</span>
0004 <span class="comment">%</span>
0005 <span class="comment">%   NoiseDS = convgausns(NoiseDS, target_cov_type)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%   Input</span>
0008 <span class="comment">%          NoiseDS        : (NoiseDS) Input noise source data structure (this must be of type 'gaussian' or 'combo-gaussian')</span>
0009 <span class="comment">%          target_cov_type : (string)  Target cov_type : 'full', 'diag', 'sqrt', 'sqrt-diag'</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%   Output</span>
0012 <span class="comment">%          NoiseDS        : (NoiseDS) Converted noise source data structure</span>
0013 <span class="comment">%</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%   See also</span>
0016 <span class="comment">%     GENNOISEDS</span>
0017 <span class="comment">%</span>
0018 <span class="comment">%   Copyright (c) Oregon Health &amp; Science University (2006)</span>
0019 <span class="comment">%</span>
0020 <span class="comment">%   This file is part of the ReBEL Toolkit. The ReBEL Toolkit is available free for</span>
0021 <span class="comment">%   academic use only (see included license file) and can be obtained from</span>
0022 <span class="comment">%   http://choosh.csee.ogi.edu/rebel/.  Businesses wishing to obtain a copy of the</span>
0023 <span class="comment">%   software should contact rebel@csee.ogi.edu for commercial licensing information.</span>
0024 <span class="comment">%</span>
0025 <span class="comment">%   See LICENSE (which should be part of the main toolkit distribution) for more</span>
0026 <span class="comment">%   detail.</span>
0027 
0028 <span class="comment">%=============================================================================================</span>
0029 
0030 
0031 <span class="comment">%--- ERROR CHECKING ---------------------------------------------------------------------</span>
0032 
0033 <span class="keyword">if</span> (nargin &lt; 2) error(<span class="string">' [ convgausns ] Incorrect number of input arguments.'</span>); <span class="keyword">end</span>
0034 
0035 error(<a href="consistent.html" class="code" title="function errstring = consistent(ds, type)">consistent</a>(NoiseDS,<span class="string">'NoiseDS'</span>));       <span class="comment">% Check general consistency of NoiseDS data structure</span>
0036 
0037 <span class="keyword">if</span> ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,{<span class="string">'gaussian'</span>,<span class="string">'combo-gaussian'</span>,<span class="string">'gmm'</span>})
0038   error(<span class="string">' [ convgausns ] This function can only operate on Gaussian or Combination-Gaussian noise sources.'</span>);
0039 <span class="keyword">end</span>
0040 
0041 <span class="keyword">if</span> ~ischar(target_cov_type)
0042     error(<span class="string">' [ convgausns ] Second input argument must be a string.'</span>);
0043 <span class="keyword">end</span>
0044 
0045 <span class="keyword">if</span> ~<a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(target_cov_type,{<span class="string">'full'</span>,<span class="string">'diag'</span>,<span class="string">'sqrt'</span>,<span class="string">'sqrt-diag'</span>})
0046     error([<span class="string">' [ convgausns ] Unknown target cov_type '''</span> target_cov_type <span class="string">''''</span>]);
0047 <span class="keyword">end</span>
0048 
0049 
0050 <span class="comment">%----------------------------------------------------------------------------------------</span>
0051 <span class="keyword">switch</span> target_cov_type
0052 
0053 <span class="comment">%........................................................................................</span>
0054 <span class="keyword">case</span> <span class="string">'full'</span>
0055 
0056   <span class="keyword">switch</span> NoiseDS.cov_type
0057   <span class="keyword">case</span> {<span class="string">'sqrt'</span>,<span class="string">'sqrt-diag'</span>}
0058       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0059           <span class="keyword">for</span> k=1:NoiseDS.M,
0060               NoiseDS.cov(:,:,k) = NoiseDS.cov(:,:,k) * NoiseDS.cov(:,:,k)';
0061           <span class="keyword">end</span>
0062       <span class="keyword">else</span>
0063           NoiseDS.cov = NoiseDS.cov * NoiseDS.cov';
0064       <span class="keyword">end</span>
0065   <span class="keyword">end</span>
0066   NoiseDS.cov_type = target_cov_type;
0067 
0068 <span class="comment">%........................................................................................</span>
0069 <span class="keyword">case</span> <span class="string">'diag'</span>
0070 
0071   <span class="keyword">switch</span> NoiseDS.cov_type
0072   <span class="keyword">case</span> {<span class="string">'sqrt'</span>,<span class="string">'sqrt-diag'</span>}
0073       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0074           <span class="keyword">for</span> k=1:NoiseDS.M,
0075               NoiseDS.cov(:,:,k) = diag(diag(NoiseDS.cov(:,:,k)*NoiseDS.cov(:,:,k)'));
0076           <span class="keyword">end</span>
0077       <span class="keyword">else</span>
0078           NoiseDS.cov = diag(diag(NoiseDS.cov*NoiseDS.cov'));
0079       <span class="keyword">end</span>
0080   <span class="keyword">otherwise</span>
0081       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0082           <span class="keyword">for</span> k=1:NoiseDS.M,
0083               NoiseDS.cov(:,:,k) = diag(diag(NoiseDS.cov(:,:,k)));
0084           <span class="keyword">end</span>
0085       <span class="keyword">else</span>
0086           NoiseDS.cov = diag(diag(NoiseDS.cov));
0087       <span class="keyword">end</span>
0088   <span class="keyword">end</span>
0089   NoiseDS.cov_type = target_cov_type;
0090 
0091 <span class="comment">%........................................................................................</span>
0092 <span class="keyword">case</span> <span class="string">'sqrt'</span>
0093 
0094   <span class="keyword">switch</span> NoiseDS.cov_type
0095   <span class="keyword">case</span> {<span class="string">'full'</span>,<span class="string">'diag'</span>}
0096       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0097           <span class="keyword">for</span> k=1:NoiseDS.M,
0098               NoiseDS.cov(:,:,k) = chol(NoiseDS.cov(:,:,k))';
0099           <span class="keyword">end</span>
0100       <span class="keyword">else</span>
0101           NoiseDS.cov = chol(NoiseDS.cov)';
0102       <span class="keyword">end</span>
0103   <span class="keyword">end</span>
0104   NoiseDS.cov_type = target_cov_type;
0105 
0106 <span class="comment">%........................................................................................</span>
0107 <span class="keyword">case</span> <span class="string">'sqrt-diag'</span>
0108 
0109   <span class="keyword">switch</span> NoiseDS.cov_type
0110   <span class="keyword">case</span> {<span class="string">'full'</span>,<span class="string">'diag'</span>}
0111       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0112           <span class="keyword">for</span> k=1:NoiseDS.M,
0113               NoiseDS.cov(:,:,k) = diag(diag(chol(NoiseDS.cov(:,:,k))'));
0114           <span class="keyword">end</span>
0115       <span class="keyword">else</span>
0116           NoiseDS.cov = diag(diag(chol(NoiseDS.cov)'));
0117       <span class="keyword">end</span>
0118    <span class="keyword">otherwise</span>
0119       <span class="keyword">if</span> <a href="stringmatch.html" class="code" title="function match = stringmatch(string1,string2)">stringmatch</a>(NoiseDS.ns_type,<span class="string">'gmm'</span>)
0120           <span class="keyword">for</span> k=1:NoiseDS.M,
0121               NoiseDS.cov(:,:,k) = diag(diag(NoiseDS.cov(:,:,k)));
0122           <span class="keyword">end</span>
0123       <span class="keyword">else</span>
0124           NoiseDS.cov = diag(diag(NoiseDS.cov));
0125       <span class="keyword">end</span>
0126   <span class="keyword">end</span>
0127   NoiseDS.cov_type = target_cov_type;
0128 
0129 <span class="comment">%........................................................................................</span>
0130 <span class="keyword">otherwise</span>
0131   error([<span class="string">' [ convgausns ] Unknown target cov_type '''</span> target_cov_type <span class="string">''''</span>]);
0132 <span class="keyword">end</span>
0133 
0134</pre></div>
<hr><address>Generated on Tue 26-Sep-2006 10:36:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>